import { useState } from 'react'

export default function ControlledForm() {
  const [email, setEmail] = useState('')

  const handleSubmit = (e: any) => {
    e.preventDefault()
    alert(`Submitted Email: ${email}`)
  }

  return (
    <form onSubmit={handleSubmit}>
      <label>Email: </label>
      <input type='email' value={email} onChange={(e) => setEmail(e.target.value)} />
      <button type='submit'>Submit</button>
    </form>
  )
}
